package com.ihr360.binlog.dto;

import com.ihr360.commons.model.entity.NumberIdWithTime;
import com.ihr360.commons.model.type.BinLogEventStatus;
import com.ihr360.hibernate.type.json.JsonStringType;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * @author richey
 */
@TypeDefs({
        @TypeDef(name = "json", typeClass = JsonStringType.class)
})
@Entity
public class BinLogReceivedEvent extends NumberIdWithTime<Long> implements Serializable {
    protected static final long serialVersionUID = -8514699820930032344L;

    //todo 事件类型表
    @Transient
    public static final Long TYPE = 1L;


    @Column(columnDefinition = "text")
    @Type(type = "json")
    private String content;

    @Column
    private Long type = TYPE;

    @Column
    @Enumerated(EnumType.STRING)
    private BinLogEventStatus status = BinLogEventStatus.PENDING;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getType() {
        return type;
    }

    public void setType(Long type) {
        this.type = type;
    }

    public BinLogEventStatus getStatus() {
        return status;
    }

    public void setStatus(BinLogEventStatus status) {
        this.status = status;
    }
}
